<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>图书购物车案例</title>
  <link rel="stylesheet" href="./css/style.css">
</head>
<body>
<div id="app">
  <table v-if="isNull">
  <thead>
  <tr>
    <th></th>
    <th>书籍名称</th>  
    <th>出版日期</th>
    <th>价格</th>
    <th>购买数量</th>
    <th>操作</th>
  </tr>
  </thead>
  <tbody>
    <tr v-for="(item,indexBooks) in books">
      <td>{{item.id}}</td>
      <td>{{item.bookName}}</td>
      <td>{{item.publishDate}}</td>
      <td>{{item.bookPrice | showPrice}}</td>
      <td>
        <button @click="increase(indexBooks)" style="width: 18px">+</button>
        {{item.purchaseQuantity}}
        <button @click="decrease(indexBooks)" style="width: 18px">-</button>
      </td>
     <td><button @click="remove(indexBooks)">移除</button></td>
    </tr>
    <tr>
      <td><span>总价</span></td>
      <td colspan="6">
        <span>{{totalPrice | showPrice}}</span>
      </td>
    </tr>
  </tbody>
  </table>
  <span v-else>购物车已经清空！</span>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="./js/bookShop.js"></script>
</body>
</html>